import './plugins/element.js'
import './css/global.css'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import './css/global.css'
import ElementUI from 'element-ui';
import axios from 'axios'
import 'element-ui/lib/theme-chalk/index.css'
import globalVariable from './global_variable.js'
Vue.prototype.GLOBAL = globalVariable
Vue.config.productionTip = false
import qs from 'qs'      //引入qs
Vue.prototype.$qs = qs

Vue.prototype.$http = axios
//配置请求的根路径
axios.defaults.baseURL = "http://localhost:9002/" //可以在login里面的methods里面发起请求
axios.interceptors.request.use(config =>{
  console.log(config);
  config.headers.Authorization = window.sessionStorage.getItem("flag");
  //要把token发到服务器
  //Authorization不符合要求或者为null就会请求失败
  //最后必须 return config，F12在network-XHR-可以看到login的登录请求
  return config
})
Vue.use(ElementUI)
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
